<template>
	<div class="p_20 indexBanner">
		<el-dialog :visible.sync="isShow" :close-on-click-modal="false" @close="closeDialog">
			<!-- <el-divider></el-divider> -->
			<el-form :model="form" label-width="80px">
				
				<AutoUpload ref="AutoUpload" :upImg = "upImg"></AutoUpload>
				
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="closeDialog">取 消</el-button>
				<el-button type="primary" @click="submit">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				isShow: false,
				
				form: {
					img_url:''
				},
				upImg:{
					label: '图片',
					imageUrl: '',
					name: 'file',
					width: '140',
					height: '160',
					file: ''
				},

				//图片上传
				imageUrl: '',
				// dialogVisible: false,
				// disabled: false
			}
		},
		methods: {
			//提交
			submit(){
				this.form.img_url = this.upImg.imageUrl;
				let params = {
					key : this.key,
					value : JSON.stringify(this.form),
					language:this.$store.getters.getLanguage
				}
				// let params = new FormData();
				
				// params.append('id', this.form.id);
				// params.append('title', this.form.title);
				// params.append('sort', this.form.sort);
				// params.append('text1', this.form.text1);
				// params.append('text2', this.form.text2);
				// params.append('text3', this.form.text3);
				// params.append('url', this.form.url);
				// params.append('language', 0);
				
				
				// if(this.upImg.file) {
				// 	params.append('file', this.upImg.file);
				// }
				
				// if(this.form.id) {
					this.edit(params);
				// }
			},
			
			
			//编辑
			edit(params) {
				this.axiosPost('Development/pipelineIndex', params , res => {
					if(res.data.code === 0) {
						this.msgSuccess(res.data.message);
						this.$parent.getTableData();
						this.isShow = false;
					}else {
						this.msgError(res.data.message)
					}
				})
			},


			
			//关闭窗口 清空数据
			closeDialog(){
				this.form = {
					img_url:''
				}
				
				this.upImg={
					label: '图片',
					imageUrl: '',
					name: 'file',
					width: '140',
					height: '160',
					file: ''
				},
				this.imageUrl = ''
				this.isShow = false;
			}
		}
	}
</script>

<style scoped>

</style>
